package com.six.backend;

import com.six.backend.pojo.SourceMaterial;
import com.six.backend.service.SourceMaterialService;
import com.six.backend.utils.QiNiuUtils;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;

/**
 * @Author: skyler
 * @Date: 2021/11/25 12:30
 */
public class QiNiuChunkUpload {
    @Autowired
    private SourceMaterialService sourceMaterialService;

    @Test
    public void qiniuChunkUploadTest() {
        String realPath = "D:\\Users\\29989\\MobileFile\\南山南.mp4";
        String name = "南山南.mp4";
        String key = QiNiuUtils.localChunkUpload(realPath,name);
        String domain = "http://skylery.walnute.top/";
        String url =  domain+ key +"?attname="+name;

        SourceMaterial sourceMaterial = new SourceMaterial();
        sourceMaterial.setId(key);
        sourceMaterial.setSource("本地上传");
        sourceMaterial.setName(name);
        sourceMaterial.setImportTime(new Date());
        sourceMaterial.setImportPeople("lisi");
        sourceMaterial.setAddress(url);

        sourceMaterialService.saveVideoSource(sourceMaterial);

    }
}
